#ifndef XMLPARSER_H
#define XMLPARSER_H

#include <qobject.h>
#include <qxml.h>
#include <qdict.h>
#include <qvaluestack.h>
#include <qregexp.h>

#include <qapplication.h>
#include <qhttp.h>
#include <qurl.h>
#include <qbuffer.h>

class Record
{
  public:
      int intid;
      QString title;
      QString description;
      QString series;
      QString rating;
      float userrating;
      QString filename;
      QString coverfile;
      QString inetref;
      QString url;
      QStringList genre;

      Record();
      ~Record();

      bool saveToDB();
};

class XMLHandler : public QXmlDefaultHandler
{
  private:

    Record *rec;
    bool inEntry;
    QValueStack<QString> stack;

  public:
    bool startDocument();
    bool startElement( const QString &ns, const QString &localName, const QString &qName, const QXmlAttributes &attrs );
    bool endElement( const QString &ns, const QString &localName, const QString &qName );
    bool characters( const QString &ch );

};


class XMLParser : public QObject
{
Q_OBJECT
public slots:
void httpFinished(int reqId, bool error);

private:


public:
  bool processingDownload;
  QHttp *http;
  QByteArray bytes;
  QBuffer *buff;
  int iRequest;
  bool errorFlag;

  XMLParser(const QString &xml_url);
  ~XMLParser();

};

#endif
